package per.mapt.webservice;

import per.mapt.webservice.vo.User;

import javax.jws.WebParam;
import javax.jws.WebService;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by mapei on 2017/3/18.
 */
@WebService(endpointInterface = "per.mapt.webservice.HelloService", serviceName = "HelloService")
public class HelloServiceImpl implements HelloService {
    Map<Integer, User> users = new LinkedHashMap<>();

    @Override
    public String sayHi(@WebParam(name = "text") String text) {
        System.out.println("sayHi called");
        return "Hello " + text;
    }

    @Override
    public String sayHiToUser(User user) {
        System.out.println("sayHiToUser called");
        users.put(users.size() + 1, user);
        return "Hello " + user.getName();
    }

    @Override
    public Map<Integer, User> getUsers() {
        System.out.println("getUsers called");
        return users;
    }
}
